import { createRouter, createWebHistory } from 'vue-router'
import Layout from "@/layout/index.vue";


//定义路由关系
const routes = [

    {
        path: "/login",
        component: () => import("@/views/login/index.vue"),
        meta: { title: "菜叶外卖", hidden: true, notNeedAuth: true }
      },
      {
        path: "/404",
        component: () => import("@/views/404.vue"),
        meta: { title: "菜叶外卖", hidden: true, notNeedAuth: true }
      },
      {
        path: "/",
        component: Layout,
        redirect: "/employee",
        children: [
          {
            path: "dashboard",
            component: () =>  import("@/views/dashboard/index.vue"),
            name: "Dashboard",
            meta: {
              title: "工作台",
              icon: "DataBoard",
              affix: true
            }
            
          },
              {
            path: "statistics",
            component: () => import("@/views/statistics/index.vue"),
            meta: {
              title: "数据统计",
              icon: "DataAnalysis"
            }
          },
          {
            path: "order",
            component: () => import("@/views/orderDetails/index.vue"),
            meta: {
              title: "订单管理",
              icon: "Tickets"
            }
          },
          {
            path: "setmeal",
            component: () => import("@/views/setmeal/index.vue"),
            meta: {
              title: "套餐管理",
              icon: "Dish"
            }
          },
          {
            path: "dish",
            component: () => import("@/views/dish/index.vue"),
            meta: {
              title: "菜品管理",
              icon: "Food"
            }
          },
          {
            path: "/dish/add",
            component: () => import("@/views/dish/addDishtype.vue"),
            meta: {
              title: "添加菜品",
              hidden: true
            }
          },
          
          {
            path: "category",
            component: () => import("@/views/category/index.vue"),
            meta: {
              title: "分类管理",
              icon: "Folder"
            }
          },
          {
            path: "comments",
            component: () => import("@/views/comments/index.vue"),
            meta: {
              title: "评论管理",
              icon: "Folder"
            }
          },
          {
            path: "employee",
            component: () => import("@/views/employee/index.vue"),
            meta: {
              title: "管理员账户管理",
              icon: "User"
            }
          },
          {
            path: "user",
            component: () => import("@/views/user/index.vue"),
            meta: {
              title: "用户管理",
              icon: "User"
            }
          },
          
       
        ]
      },
      {
        path: "/employee/add",
        component: () => import("@/views/employee/addEmployee.vue"),
        meta: {
          title: "添加/修改员工",
          hidden: true
        }
      },
      
      {
        path: "/setmeal/add",
        component: () => import("@/views/setmeal/addSetmeal.vue"),
        meta: {
          title: "添加套餐",
          hidden: true
        }
      },
      {
        path: "/:pathMatch(.*)*",
        redirect: "/404",
        meta: { hidden: true }
      }
    
]

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

//导出路由
export default router
